import { defineConfig } from 'vite'
import path from 'path'
import react from '@vitejs/plugin-react'

export default defineConfig({
    plugins: [react({
        babel:{
          plugins: ['@babel/plugin-transform-react-jsx'],
        }
      })],
      optimizeDeps: {
        entries:[],
        include:[
          'react',
          'react-dom'
        ]
      },
    resolve: {
        // 目录别名
        alias: {
          '@': path.resolve(__dirname, 'src'),
        },
    },
    css: {
        preprocessorOptions: {
          scss: {
            additionalData: "@import './src/assets/style/main.scss';"
          }
        },
    },
    server: {
        proxy: {
            '/api':
              {
                target: 'http://apis.juhe.cn/',
                changeOrigin: true,
                rewrite:
                  (path) => path.replace(/^\/api/, '')
              }
          }
    }
  })
